package org.zhadoop.stream.cql.hooks;

import org.zhadoop.stream.cql.DriverContext;
import org.zhadoop.stream.cql.exception.SemanticAnalyzerException;
import org.zhadoop.stream.cql.semanticanalyzer.analyzecontext.AnalyzeContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.context.ParseContext;

/**
 * 语义分析前后的钩子
 * @author zwd
 *
 */
public interface SemanticAnalyzeHook extends Hook{
	
	/**
	 * 验证是否属于该hook的执行范围
	 * @param parseContext
	 * @return
	 * @throws SemanticAnalyzerException
	 */
	boolean validate(ParseContext parseContext) throws SemanticAnalyzerException;
	
	/**
	 * 语义分析之前执行的动作
	 * @param context
	 * @param parseContext
	 * @throws SemanticAnalyzerException
	 */
	void preAnalyze(DriverContext context,ParseContext parseContext) throws SemanticAnalyzerException;
	
	/**
	 * 语义分析之后执行的动作
	 * @param context
	 * @param parseContext
	 * @throws SemanticAnalyzerException
	 */
	void postAnalyze(DriverContext context,AnalyzeContext analyzeContext) throws SemanticAnalyzerException;
}
